<?php 
define('__ROOT__', dirname(dirname(__FILE__))); 
include_once(__ROOT__.'../../includes/header.php');
include_once(__ROOT__.'../../includes/leftnav.php');
 ?>
<div class="span7">
	<ul class="breadcrumb">
	<li>
		<a href="<?php echo base_url('/home'); ?>">Home</a> <span class="divider">/</span>
	</li>
	<li>
		<a href="<?php echo base_url('/admin/dashboard'); ?>">Dashboard</a><span class="divider">/</span>
	</li>
	<li>
		<a href="<?php echo base_url('/admin/automobiles/view'); ?>">Automobiles</a><span class="divider">/</span>
	</li>
	<li>Post Automobile Ad</li>
</ul>
<div id="content" class="span10">
<h4>Advertise your vehicle with MayKha! Find out amazing results.</h4>
<?php 
echo validation_errors();
if (isset($message))
	echo $message;
	$attributes = array('class' => 'form-vertical' , 'id' => 'automobilefrm');
	echo form_open_multipart($action, $attributes);?>
	<fieldset>
			<div class="row-fluid">
			<div class="span12">
				<label>Brands</label> 
				<select id="brand" name="brand" data-rel="chosen">
						<?php
						foreach ($brands as $key => $value) {
							echo '<option value="' . $key . '">';
							echo $value;
							echo '</option>';
						}
						?>
				</select>
				
			</div>
			</div>
			<div class="row-fluid">
				<div class="span12">
						<label>Types</label>
						<select id="selectType" name="selectType" data-rel="chosen">
						<?php
						foreach ($types as $key => $value) {
							echo '<option value="' . $key . '"';
							if (isset($selectType)){
								if ((int)$selectType  === (int)$key)
									echo 'selected ';
								}
							echo '>';
							echo $value;
							echo '</option>';

						}						
						?>
					</select>
				</div>
			</div>
			<!--/row-->
			<div class="control-group">
				<label>Title</label>
				<input type="text" class="span7"
						placeholder="Enter your advertisement's title here" name="autotitle" id="autotitle" value="<?php echo set_value('title'); ?>">
			</div>
			
			<!--row-->
			<div class="row-fluid">
				<div class="span12">
					<label>Models</label> <input type="text" class="span5"
						placeholder="Specify car's model here" name="model" id="model" value="<?php echo set_value('models'); ?>">
				</div>
			</div>
			<!--/row-->
			<div class="row-fluid">
				<div class="span7">
					<label>Price</label>
						<input id="autoprice" name="autoprice" class="span5" type="text">
						
						<select id="price_denote" name="price_denote" class="span3 right" data-rel="chosen">
							  <option value="KS" selected>KS</option>
							  <option value="LAKH">LAKH</option>
							  <option value="USD">USD</option>
							  <option value="SGD">SGD</option>
							  <option value="CNY">CNY</option>
						</select>
					<span id="errorprice"></span>
				</div>
				<div class="span4">
					<input style="margin-bottom:0px" id="isnegotaible" name="isnegotaible" type="checkbox" checked>Is Negotiable
				</div>
			</div>
			<!--/row-->
			<div class="row-fluid">
				<div class="span9">
					<label>Descriptions
					<textarea class="cleditor" id="adescriptions" name="adescriptions"
							rows="3">
							<?php echo set_value('adescriptions'); ?>
					</textarea>
					</label>
				</div>
			</div>
			<br>
			<!--/row-->
			<fieldset>
				<legend>Vehicle Features</legend>
				<div class="row-fluid">
					<div class="span4">
						<label>Condition</label>
						<input id="condition" name="condition" class="span7" type="text" value="<?php echo set_value('condition'); ?>">
					</div>
					<div class="span4">
						<label>Mileage</label>
						<input id="mileage" name="mileage" class="span7" type="text" value="<?php echo set_value('mileage'); ?>">
					</div>
					<div class="span4">
						<label>Registration Year</label>
						<input id="regyear" name="regyear" class="span7" type="text" value="<?php echo set_value('regyear'); ?>">
					</div>
				</div>
				<div class="row-fluid">
					<div class="span4">
						<label>Fuel Type</label>
						<select id="fuel_type" name="fuel_type" class="span7 right">
							  <option value="GS" selected>Gas</option>
							  <option value="OL">Oil</option>
							  <option value="CNG">CNG</option>
							  <option value="HBD">Hybrid</option>
						</select>
					</div>
					<div class="span4">
						<label>No. of seats</label>
						<input id="seats" name="seats" class="span7" type="text" value="<?php echo set_value('seats'); ?>">
					</div>
					<div class="span4">
						<label>Engine size</label>
						<input id="engsize" name="engsize" class="span7" type="text" value="<?php echo set_value('engsize'); ?>">
					</div>
				</div>
			</fieldset>
			<fieldset>
			<legend>Contact Information</legend>
			<div class="row-fluid">
				<div class="span4">
					<label>Contact Person</label> 
					<input id="contact_person" name="contact_person" class="span10" type="text" value="<?php echo set_value('contact_person', isset($user['displayName']) ? $user['displayName'] : $user['name']); ?>">
				</div>
				<!--/span-->
				<div class="span4">
					<label>Contact No</label>
					<input id="contact_no" name="contact_no"
						class="span10" type="text"  value="<?php echo set_value('contact_no', $user['phone']); ?>">
				</div><!--/span-->
			</div>
			<!-- /row -->
			<div class="row-fluid">
				<div class="span4">
					<label>Email</label> <input id="contact_email" name="contact_email" type="text" class="span10"
						placeholder="user@example.com" value="<?php echo set_value('contact_email', $user['email']); ?>">
				</div>
				<div class="span4">
					<label>Expired On</label>
					<input id="expired_date" name="expired_date" type="text" class="span10 disabled"
						placeholder="DD/MM/YYYY" value="<?php echo set_value('expired_date', isset($expired_date) ? $expired_date : ''); ?>">
				</div>
				<!--/span-->
			</div>
			</fieldset>
			<!-- /row -->
			<div class="row-fluid">
				<div class="span12">
					<label>Add Images</label> <input data-no-uniform="true"
						type="file" name="userfile[]" id="file_upload" multiple="multiple" />
					<p class="help-block">Choose muliple files (Maximum 3 images)</p>
				</div>
			</div>
			<!-- /row -->
			<div class="form-actions">
				<button type="submit" class="btn btn-primary">Submit</button>
				<button class="btn" type="reset">Cancel</button>
			</div>
			<!-- /row -->
	</fieldset>
</div>
</div>
<!-- right nav -->
</div>
<?php include_once(__ROOT__.'../../includes/footer.php'); ?>